<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/style.css">
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>创建店铺</title>
    <style>
        .fileInput{
            width:100%;
            height:100%;
            position:absolute;
            opacity: 0;
            filter:alpha(opacity=0);
            cursor:pointer;
        }
        #wall_1{
            background:url(__STATIC__/img/logo1.png);
            background-size: 100% 100%;
            top: 40%;
            left: 41%;
            width:15%;
            border: 3px solid white;
            border-radius: 100%;
            position:absolute;
        }
        #wall_0{
            background:url(__STATIC__/img/bg5.png);
            background-size: 100% 100%;
            width:100%;
            /*position:absolute;*/
        }
    </style>
    <script>
        $(document).ready(function () {
            var wall_1 = document.getElementById('wall_1');
            wall_1.style.height=wall_1.offsetWidth-6+'px';
            var wall_0 = document.getElementById('wall_0');
            wall_0.style.height=wall_0.offsetWidth*0.2+'px';
        })
    </script>
</head>
<body>
<form method="post" action="" id="form" enctype="multipart/form-data">
<div class="wrap-cre">
    <div class="header">
        <p>创建店铺</p>
        <img src="__STATIC__/img/back.png" onclick =window.location.href="{:url('mobile/shop_auth/index')}"; class="back">
    </div>
    <div class="center">
        <div class="info">
            <!--<img src="__STATIC__/img/bg5.png" id="pic1" class="pic1">-->
            <div class="fileInputContainer" id="wall_0">
            <input type="file" class="fileInput" name="file[]" accept="image/*" id="imgInp_0" />
            </div>
            <div class="fileInputContainer" id="wall_1">
            <input type="file" class="fileInput" name="file[]" accept="image/*" id="imgInp_1" />
            <img src="__STATIC__/img/bianji.png" width="40%" id="edit" style="margin:60% 0 0 60%;"  />
            </div>
        </div>
        <div class="name">
            <p><b>- 店铺名称 -</b></p>
            <p><b>点击头像上传店铺头像图标</b></p>
        </div>
        <input class="text" type="text" name="title" required placeholder="请输入店铺名称(建议少于10个字)">
    </div>
    <div class="submit">
        <input type="button" onclick="putData()" value="完成">
    </div>
</div>
</form>
{include file="public/src" /}
<script>
    function putData(){
        var val = $("[name='title']").val();
        if (val == ''){
            layer.open({content:'名称不能为空',skin:'msg',time:2});
            return false;
        };
        if (val.length > 10){
            layer.open({content:'名称字数过多',skin:'msg',time:2});
            return false;
        }
        if ($("#imgInp_0").val() == ''){
            layer.open({content:'请上传背景图',skin:'msg',time:2});
            return false;
        }
        if ($("#imgInp_1").val() == ''){
            layer.open({content:'请上传头像',skin:'msg',time:2})
            return false;
        }
        $('#form').ajaxSubmit({
            url:"{:url('mobile/shop_auth/createShop')}",
            type:"post",
            dataType:'json',
            enctype: 'multipart/form-data',
            success:function (t) {
                if (t.code == 200){
                    mh_dialogShow('mh_success',t.message,1,true,"myShop");
                }else {
                    layer.open({content:t.message,btn:'我知道了'});
                }
            },
            error: function () {
                layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
            }
        })
    }
</script>
</body>
</html>